package org.cloud.service;

import org.cloud.entity.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@FeignClient(value = "spring-provider", fallback = DeptClientServiceFallback.class)
// 需要注意的是 value 里面必须是微服务名字, 不能为 ID, 出现服务不存在的时候, 将 Fallback 内容返回浏览器
public interface DeptClientService {
    @RequestMapping(value = "/dept/list", method = RequestMethod.GET)
    List<Dept> listDept();


    @RequestMapping(value = "/dept/add", method = RequestMethod.POST)
    boolean addDept(Dept dept);


    @RequestMapping(value = "/dept/get/{id}", method = RequestMethod.GET)
    Dept getDept(@PathVariable("id") Integer id);

    @RequestMapping(value = "/discovery/{serviceId}", method = RequestMethod.GET)
    Object discovery(@PathVariable("serviceId") String serviceId);

    @RequestMapping(value = "/offline", method = RequestMethod.GET)
        // 下线服务
    void offLine();
}
